package sun.com;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class test {
    public static void main(String[] args) {
        List<Student> list = Arrays.asList(
                new Student("老大",12,8000),
                new Student("老1",50,800),
                new Student("老2",40,8000),
                new Student("老3",80,600),
                new Student("老4",8,3000),
                new Student("老5",76,400)
                );
        //年龄大于50
//        List<Student> l =age(list,(Student s)->s.getAge()>50);
        //工资大于三千
        List<Student> li = age(list,(Student s)->s.getSalary()>3000);
        for(Student ss:li){
            System.out.println(ss);
        }

    }
    public static List<Student> age(List<Student> student,MyInterface<Student> inter){
        List<Student> list = new ArrayList<>();
        for(Student s:student){
            if(inter.test(s)){
                list.add(s);
            }
        }
        return list;
    }
}
